import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
import AboutView from '../views/AboutView.vue'
import PreviewView from '../views/PreviewView.vue'
import FolderView from '../views/FolderView.vue'
import MedicalVideoHub from '../views/MedicalVideoHub.vue'
import MedicalLayout from '../layouts/MedicalLayout.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      component: HomeView
    },
    {
      path: '/about',
      name: 'about',
      component: AboutView
    },
    {
      path: '/preview/:key',
      name: 'preview',
      component: PreviewView,
      props: true
    },
    {
      path: '/folder/:prefix?',
      name: 'folder',
      component: FolderView,
      props: true
    },
    {
      path: '/medical-videos',
      name: 'medical-videos',
      component: MedicalVideoHub
    },
    {
      path: '/medical',
      component: MedicalLayout,
      children: [
        {
          path: '',
          name: 'medical-standalone',
          component: MedicalVideoHub
        }
      ]
    },
    {
      // 处理 404 情况
      path: '/:pathMatch(.*)*',
      redirect: '/'
    }
  ]
})

export default router 